﻿using GYCTOAManagementSystemNewApi.Model;
using GYCTOAManagementSystemNewApi.Model.Tool;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace GYCTOAManagementSystemNewApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    [Authorize]
    public class AppController : Controller
    {
        private readonly ILogger<LoginController> _logger;
        DBContext _db;
        // private static IHostingEnvironment _hostingEnvironment;
        public AppController(ILogger<LoginController> logger, DBContext context/*  ,IHostingEnvironment hostingEnvironment*/)
        {
            _logger = logger;
            _db = context;
            // _hostingEnvironment = hostingEnvironment;
        }
        
        /// <summary>
        /// 修改是否震动
        /// </summary>
        /// <param name="userId">人员Id</param>
        /// <param name="Isshock">是否震动</param>
        /// <returns></returns>
        //[HttpPost("SetIsshockByUserId")]
        //public JsonResult SetIsshockByUserId(int userId, bool Isshock)
        //{
        //    var UserById = _db.User.Find(userId);
        //    UserById.Isshock = Isshock;
        //    _db.Update(UserById);
        //    var bit = _db.SaveChanges() > 0;
        //    return Json(new { result = bit });
        //}

    }
}